from celery import shared_task
from django.db.models.signals import post_save

from .models import Add


@shared_task
def add(aid):
    ins_add = Add.objects.get(pk=aid)
    ins_add.result = ins_add.x + ins_add.y

    #ins_add.save()

    # Avoid infinite loop
    ins_add.save_without_signals()

    return aid

